package test.zookeeper;  

import java.io.IOException;
import java.util.List;

import org.apache.zookeeper.KeeperException;

/**  
 * @类名 ZkServer.java  
 * @描述: 
 *     zookeeper的操作封装接口，实现了常用的操作 
 *     创建、销毁、写入、修改、查询等。
 * @作者 梅光弦  
 * @创建时间 2012-12-4 下午02:49:58  
 * @版本 v1.0  
 */
public interface ZkServer {
	/**
	 * 
	 * @param address
	 * @param serverName
	 * @throws IOException
	 */
    public void init(String address) throws IOException;
    
    /**
     * 
     * @throws InterruptedException
     */
    public void destroy() throws InterruptedException;
    
    /**
     * 
     * @param path
     * @return
     * @throws KeeperException
     */
    public List<String> getChilds(String path) throws KeeperException, InterruptedException;
    
    /**
     * 
     * @param path
     * @return
     * @throws KeeperException
     * @throws InterruptedException
     */
    public String getData(String path) throws KeeperException, InterruptedException;
    
    /**
     * 
     * @param path
     * @param data
     * @throws KeeperException
     */
    public void changeData(String path, String data) throws KeeperException, InterruptedException;
    
    
    /**
     * 
     * @param path
     * @param data
     * @throws KeeperException
     * @throws InterruptedException
     */
    public void appendTempNode(String path, String data) throws KeeperException, InterruptedException;
    
    /**
     * 
     * @param path
     * @param data
     * @throws KeeperException
     * @throws InterruptedException
     */
    public void appendPresistentNode(String path, String data) throws KeeperException, InterruptedException;
    
    /**
     * 
     * @param path
     * @throws KeeperException
     * @throws InterruptedException
     */
    public void delNode(String path) throws KeeperException, InterruptedException;
    
    /**
     * 
     * @param path
     * @return
     * @throws KeeperException
     * @throws InterruptedException
     */
    public boolean exist(String path) throws KeeperException,InterruptedException;
      
}
 